#include <iostream>
#include <memory>
#include <vector>
using namespace std;

void test0(){
    shared_ptr<int> sp(new int(45));
    cout << *sp << endl;
    cout << sp << endl;
    cout << sp.get() << endl;
    cout << sp.use_count() << endl;
    vector<shared_ptr<int>> vec;
    vec.push_back(sp);
    cout << vec[0] << endl;
    cout << sp.use_count() << endl;

    shared_ptr<int> sp2(sp);
    cout << sp2.use_count() << endl;
    vec.push_back(move(sp2)); //sp2将int资源的管理权移交给vector的第二个元素
    cout << sp2.use_count() << endl;
}

int main (void){
    test0();
    return 0;
}